]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: Use more template strings
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 29 Oct 2019 18:21:21 +0000 (19:21 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Tue, 5 Nov 2019 01:51:29 +0000 (01:51 +0000)
xgettext got better at recognizing template strings, so we can
replace more string concatenations. Alas xgettext is still buggy
(surprise, regular expressions are hard), so there are still a
handful of holdouts that prevent us from making a complete switch.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/792

js/misc/fileUtils.js
js/portalHelper/main.js
js/ui/appDisplay.js
js/ui/magnifierDBus.js
js/ui/main.js
js/ui/messageList.js
js/ui/padOsd.js
js/ui/runDialog.js
js/ui/screenShield.js
js/ui/shellDBus.js

index 338460ce68b75f4846bb88f664d7f9da28291ed5..5a4ae3eeef038d0f522ac6cb217cf75725dfc347 100644 (file)
@@ -76,13 +76,13 @@ function loadInterfaceXML(iface) {
     if (!_ifaceResource) {
         // don't use global.datadir so the method is usable from tests/tools
         let dir = GLib.getenv ('GNOME_SHELL_DATADIR') || Config.PKGDATADIR;
-        let path = dir + '/gnome-shell-dbus-interfaces.gresource';
+        let path = `${dir}/gnome-shell-dbus-interfaces.gresource`;
         _ifaceResource = Gio.Resource.load(path);
         _ifaceResource._register();
     }
 
     let xml = null;
-    let uri = 'resource:///org/gnome/shell/dbus-interfaces/' + iface + '.xml';
+    let uri = `resource:///org/gnome/shell/dbus-interfaces/${iface}.xml`;
     let f = Gio.File.new_for_uri(uri);
 
     try {
index f98a10dcec11a772b208530b586e8e0985adf4f9..f6124e5eff9719a9daf4c881a51086d835c98098 100644 (file)
@@ -21,7 +21,7 @@ const PortalHelperSecurityLevel = {
 };
 
 const CONNECTIVITY_CHECK_HOST = 'nmcheck.gnome.org';
-const CONNECTIVITY_CHECK_URI = 'http://' + CONNECTIVITY_CHECK_HOST;
+const CONNECTIVITY_CHECK_URI = `http://${CONNECTIVITY_CHECK_HOST}`;
 const CONNECTIVITY_RECHECK_RATELIMIT_TIMEOUT = 30 * GLib.USEC_PER_SEC;
 
 const HelperDBusInterface = loadInterfaceXML('org.gnome.Shell.PortalHelper');
index 43b1860f8057b168e63f1a91a933bb49a3ba6a93..cb08acceafc4239c4c49add68dea497ab84ec451 100644 (file)
@@ -66,7 +66,7 @@ function _getFolderName(folder) {
 
     if (folder.get_boolean('translate')) {
         let keyfile = new GLib.KeyFile();
-        let path = 'desktop-directories/' + name;
+        let path = `desktop-directories/${name}`;
 
         try {
             keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE);
@@ -469,7 +469,7 @@ var AllView = GObject.registerClass({
 
         let folders = this._folderSettings.get_strv('folder-children');
         folders.forEach(id => {
-            let path = this._folderSettings.path + 'folders/' + id + '/';
+            let path = `${this._folderSettings.path}folders/${id}/`;
             let icon = this._items[id];
             if (!icon) {
                 icon = new FolderIcon(id, path, this);
index b71cd0db582d2fe67b5486073c4b70350f349f21..99921a142600d4893c7a1bb6e3f66c69d3115baf 100644 (file)
@@ -137,7 +137,7 @@ var ShellMagnifier = class ShellMagnifier {
             }
             if (!found) {
                 // Got a ZoomRegion with no DBus proxy, make one.
-                let newPath =  ZOOM_SERVICE_PATH + '/zoomer' + _zoomRegionInstanceCount;
+                let newPath = `${ZOOM_SERVICE_PATH}/zoomer${_zoomRegionInstanceCount}`;
                 _zoomRegionInstanceCount++;
                 let zoomRegionProxy = new ShellMagnifierZoomRegion(newPath, aZoomRegion);
                 let proxyAndZoomer = {};
index 63db238296a12a51c843e2265c589a8788efb935..5e0de5e87a0b2f060102a41283b2e0587c608c74 100644 (file)
@@ -289,7 +289,7 @@ function _initializeUI() {
 function _getStylesheet(name) {
     let stylesheet;
 
-    stylesheet = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/' + name);
+    stylesheet = Gio.File.new_for_uri(`resource:///org/gnome/shell/theme/${name}`);
     if (stylesheet.query_exists(null))
         return stylesheet;
 
@@ -301,7 +301,7 @@ function _getStylesheet(name) {
             return stylesheet;
     }
 
-    stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + name);
+    stylesheet = Gio.File.new_for_path(`${global.datadir}/theme/${name}`);
     if (stylesheet.query_exists(null))
         return stylesheet;
 
@@ -359,12 +359,12 @@ function reloadThemeResource() {
     if (_themeResource)
         _themeResource._unregister();
 
-    _themeResource = Gio.Resource.load(global.datadir + '/gnome-shell-theme.gresource');
+    _themeResource = Gio.Resource.load(`${global.datadir}/gnome-shell-theme.gresource`);
     _themeResource._register();
 }
 
 function _loadOskLayouts() {
-    _oskResource = Gio.Resource.load(global.datadir + '/gnome-shell-osk-layouts.gresource');
+    _oskResource = Gio.Resource.load(`${global.datadir}/gnome-shell-osk-layouts.gresource`);
     _oskResource._register();
 }
 
index 06fa11e212d7ac3b9df534e8c6765d36c591ee99..01f1da485062482adbe9ecaa5361d399831ee3db 100644 (file)
@@ -79,7 +79,7 @@ class URLHighlighter extends St.Label {
         if (urlId != -1) {
             let url = this._urls[urlId].url;
             if (!url.includes(':'))
-                url = 'http://' + url;
+                url = `http://${url}`;
 
             Gio.app_info_launch_default_for_uri(
                 url, global.create_app_launch_context(0, -1));
@@ -132,7 +132,7 @@ class URLHighlighter extends St.Label {
         for (let i = 0; i < urls.length; i++) {
             let url = urls[i];
             let str = this._text.substr(pos, url.pos - pos);
-            markup += str + '<span foreground="' + this._linkColor + '"><u>' + url.url + '</u></span>';
+            markup += `${str}<span foreground="${this._linkColor}"><u>${url.url}</u></span>`;
             pos = url.pos + url.url.length;
         }
         markup += this._text.substr(pos);
index 854e0f61edbf4639092424c25c1070d4c8b644a1..75e274f33fe7c30a13977ee83dcb2700f11a9520 100644 (file)
@@ -844,7 +844,8 @@ var PadOsd = GObject.registerClass({
             this._tipLabel.set_text(_("Press any key to exit"));
         }
 
-        this._titleLabel.clutter_text.set_markup('<span size="larger"><b>' + title + '</b></span>');
+        this._titleLabel.clutter_text.set_markup(
+            `<span size="larger"><b>${title}</b></span>`);
     }
 
     _isEditedAction(type, number, dir) {
index fba1dc7fb2ba6172025be4fc3252fc7d4b3bb48b..8154b94273e1fe90b5b2f76e0e393f8bfaa5c3f8 100644 (file)
@@ -210,7 +210,7 @@ class RunDialog extends ModalDialog.ModalDialog {
                 } else {
                     if (input.charAt(0) == '~')
                         input = input.slice(1);
-                    path = GLib.get_home_dir() + '/' + input;
+                    path = `${GLib.get_home_dir()}/${input}`;
                 }
 
                 if (GLib.file_test(path, GLib.FileTest.EXISTS)) {
index 3712c198a4c9b09d00cba75fddb5cefacfcff656..71f8795ac772172e76822388defadba60a7a1406 100644 (file)
@@ -189,7 +189,7 @@ var NotificationsBox = GObject.registerClass({
             }
 
             let label = new St.Label({ style_class: 'screen-shield-notification-count-text' });
-            label.clutter_text.set_markup('<b>' + n.title + '</b> ' + body);
+            label.clutter_text.set_markup(`<b>${n.title}</b> ${body}`);
             textBox.add(label);
 
             visible = true;
index fca0b6425537c8ecebc76a76336ef401b5569bda..8b3db8fc0ea401b0e02e454f2a4888e4f89a3612 100644 (file)
@@ -304,7 +304,7 @@ var GnomeShellExtensions = class {
         let app = appSys.lookup_app('gnome-shell-extension-prefs.desktop');
         let info = app.get_app_info();
         let timestamp = global.display.get_current_time_roundtrip();
-        info.launch_uris(['extension:///' + uuid],
+        info.launch_uris([`extension:///${uuid}`],
                          global.create_app_launch_context(timestamp, -1));
     }